Skip to content

Add restart IntelliSense command for active file - #4380

Closed
amritamishra01 wants to merge 2 commits into
redhat-developer:mainfrom
amritamishra01:feat/restart-intellisense-active-file
Closed

amritamishra01 wants to merge 2 commits into
redhat-developer:mainfrom
amritamishra01:feat/restart-intellisense-active-file

Conversation

@amritamishra01

Copy link
Copy Markdown
Contributor

Fixes #4293

Summary

This PR adds a new editor context menu action “Restart IntelliSense for Active File” for Java files.

The command appears when right-clicking inside a Java editor and reuses the existing Java language server restart flow to refresh IntelliSense.

Changes

  • Added a new command: java.runtime.restartIntellisense
  • Added command palette contribution in package.json
  • Added editor context menu contribution for Java files
  • Registered the command in src/extension.ts
  • Reused the existing java.server.restart command instead of duplicating restart logic
  • Scoped the action to the active Java editor only

Testing

  • Ran npm run compile successfully

  • Verified command registration in:

    • src/commands.ts
    • src/extension.ts
    • package.json
  • Launched Extension Development Host

  • Opened a .java file

  • Verified the context menu shows Restart IntelliSense for Active File

  • Verified the command reuses the existing restart language server flow

Notes

Since the Java language server operates at the workspace level, this command is exposed only for the active Java editor while internally reusing the existing workspace-level restart behavior.

@robstryker

Copy link
Copy Markdown
Contributor

Hey @amritamishra01

Thanks for the patch and the idea, but, I don't think we're going to go in this direction.

Having the LSP glitch up does happen on occasion, but we usually present a popup to the user when it's needed (eg. a setting that won't take effect until the extension is restarted was changed). The "Restart and delete workspace" command, which is already available to end users, is more helpful for the cases where we don't explicitly prompt the user to restart (as an example of such a case: project was imported wrong and needs to be reimported).

But thanks a lot for trying your hand at it!

@robstryker robstryker closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add “Restart Intellisense for Active File”

2 participants